import request from '@/utils/request'

export function login(data) {
  return request({
    url: '/user/login',
    method: 'post',
    data
  })
}

export function getInfo(token) {
  return request({
    url: '/user/info',
    method: 'get',
    params: { token }
  })
}

export function logout() {
  return request({
    url: '/user/logout',
    method: 'post'
  })
}

export function getList(params) {
  return request({
    url: '/user/getList',
    method: 'get',
    params,
  })
}

export function save(data) {
  return request({
    url: '/user/save',
    method: 'post',
    data
  })
}

export function getDetail(params) {
  return request({
    url: '/user/detail',
    method: 'get',
    params,
  })
}

export function userUpdatePassword(data) {
  return request({
    url: '/user/updatePassword',
    method: 'post',
    data
  })
}

export function userCheckPassword(data) {
  return request({
    url: '/user/checkPassword',
    method: 'post',
    data
  })
}

export function getUserProductList(params) {
  return request({
    url: '/userProduct/getList',
    method: 'get',
    params,
  })
}

export function userProductSave(data) {
  return request({
    url: '/userProduct/save',
    method: 'post',
    data
  })
}

export function updateUserProductConfig(data) {
  return request({
    url: '/userProduct/updateConfig',
    method: 'post',
    data
  })
}

export function setProductChannel(data) {
  return request({
    url: '/userProduct/setProductChannel',
    method: 'post',
    data
  })
}

export function getUserProductDetail(params) {
  return request({
    url: '/userProduct/detail',
    method: 'get',
    params,
  })
}

export function userRecharge(data) {
  return request({
    url: '/user/userRecharge',
    method: 'post',
    data
  })
}

export function resetPassword(data) {
  return request({
    url: '/user/resetPassword',
    method: 'post',
    data
  })
}

export function getUserAuthentication(data) {
  return request({
    url: '/user/getUserAuthentication',
    method: 'post',
    data
  })
}

export function getSupplierList(params) {
  return request({
    url: '/supplier/getList',
    method: 'get',
    params,
  })
}

// 产品分类
export function getProductCategoryList(params) {
  return request({
    url: '/productCategory/getList',
    method: 'get',
    params,
  })
}

export function getProductCustomerStatistics(params) {
  return request({
    url: '/product/productCustomerStatistics',
    method: 'get',
    params,
  })
}

export function getProductSupplierStatistics(params) {
  return request({
    url: '/product/productSupplierStatistics',
    method: 'get',
    params,
  })
}